﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using XeBus.BusinessLogic;
using XeBus.BusinessObject;

namespace XeBus.Controller
{
    public partial class frmThemMoi : Form
    {
        private TuyenXeBuyt txb = new TuyenXeBuyt();
        private TuyenXeBusBUS txbBUS = new TuyenXeBusBUS();
        public frmThemMoi()
        {
            InitializeComponent();
        }

        private void btLuuLai_Click(object sender, EventArgs e)
        {
            try
            {
                txb.So_Hieu_Tuyen = txtSoHieu.Text.Trim();
                txb.Ten_Tuyen = txtTenTuyen.Text.Trim();
                txb.Chieu_Dai_Tuyen = txtChieuDai.Text.Trim();
                txb.TG_Bat_Dau = txtTGBatDau.Text.Trim();
                //txb.TG_Bat_Dau = mtbBatDau.Text.Trim();
                txb.TG_Ket_Thuc = txtTGKetThuc.Text.Trim();
                //txb.TG_Ket_Thuc = mtbKetThuc.Text.Trim();
                txb.TG_Gian_Cach_CD = txtCaoDiem.Text.Trim();
                txb.TG_Gian_Cach_TD = txtThapDiem.Text.Trim();

                txbBUS.THEM_TUYEN_XE(txb);
                MessageBox.Show("Thêm mới dữ liệu thành công.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Close();

            }
            catch (Exception) 
            {
                MessageBox.Show("Thêm mới dữ liệu thất bại.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }

        private void btHuyBo_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
